package com.yanqu.road.server.cmd.npc;

import com.yanqu.road.pb.npc.NpcEventProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.npc.NpcEventModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;


@Cmd(code = Protocol.S_NPC_TRADE_EVENT_START, desc = "Npc贸易备货")
public class NpcTradeStockCmd extends AbstractCommand {

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
		ret = player.getModule(NpcEventModule.class).npcTradeEventStock();
	}

	@Override
	public void sendData(GamePlayer player) {
		NpcEventProto.NpcTradeStockRespMsg.Builder respMsg = NpcEventProto.NpcTradeStockRespMsg.newBuilder();
		respMsg.setRet(ret);
		player.sendPacket(Protocol.U_NPC_TRADE_EVENT_START, respMsg);
	}
}
